@model IEnumerable<Web.Models.SpUser>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th></th>
        <th>
            Email
        </th>
        <th>
            Password
        </th>
        <th>
            Detail
        </th>
        <th>
            Tickets
        </th>
        <th>
            Company
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.SpUserId }) |
            @Html.ActionLink("Details", "Details", new { id=item.SpUserId }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.SpUserId })
        </td>
        <td>
			@item.Email
        </td>
        <td>
			@item.Password
        </td>
        <td>
			@(item.Detail == null ? "None" : item.Detail.Name)
        </td>
        <td>
			@(item.Tickets == null ? "None" : item.Tickets.Count.ToString())
        </td>
        <td>
			@Html.DisplayTextFor(_ => item.Company).ToString()
        </td>
    </tr>
}

</table>


